home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
cpphtp2
/
code.jar
/
code
/
ch03
/
fig03_19.txt
< prev
next >
Wrap
Text File
|
1998-02-27
|
476b
|
21 lines
1 // Fig. 3.19: fig03_19.cpp
2 // Using an inline function to calculate
3 // the volume of a cube.
4 #include <iostream.h>
5
6 inline float cube( const float s ) { return s * s * s; }
7
8 int main()
9 {
10 cout << "Enter the side length of your cube: ";
11
12 float side;
13
14 cin >> side;
15 cout << "Volume of cube with side "
16 << side << " is " << cube( side ) << endl;
17
18 return 0;
19 }